<?php

namespace Gnway\Ticket\Rest\Annotation;

use Doctrine\Common\Annotations\Annotation\Target;
use Doctrine\Common\Annotations\Annotation\Attribute;
use Doctrine\Common\Annotations\Annotation\Attributes;

/**
 * Property annotation
 *
 * @Annotation
 * @Target("PROPERTY")
 * @Attributes(
 *   @Attribute("name", type="string", required=false)
 * )
 */
class Resource
{

  /**
   * Property name
   *
   * @var string
   */
  private string $name = '';

  /**
   * Resource constructor.
   *
   * @param array $values
   */
  public function __construct(array $values)
  {
    if (isset($values['value'])) {
      $this->name = (string)$values['value'];
    }
    if (isset($values['name'])) {
      $this->name = (string)$values['name'];
    }
  }

  /**
   * @return string
   */
  public function getName(): string
  {
    return $this->name;
  }
}